#include <iostream>
#include <math.h>

using namespace std;

int main() {
    float annualInterestRate, numberOfYears, loanAmount;

    cout << "Please input the annual interest rate: ";
    cin >> annualInterestRate;

    cout << "\nPlease input the number of years: ";
    cin >> numberOfYears;

    cout << "\nPlease input the loan amount: ";
    cin >> loanAmount;

    float monthlyInterestRate = annualInterestRate / 1200;
    float monthlyPayment = loanAmount * monthlyInterestRate / ( 1 - 1 / pow(( 1 + monthlyInterestRate), numberOfYears * 12 ));

    float totalPayment = monthlyPayment * 12 * numberOfYears;

    cout << "\n\n\nThe monthly payment is: " << monthlyPayment << "\nThe total payment is: " << totalPayment << endl;

    return 0;
}
